{include file="public/header" select="2" /}
<body class="bgc" style="padding-top: 0">
<ul class="address-list" id="address">
    {foreach name="list" item="vo"}
    <li class="choice" data-id="{$vo.id}">
        <van-swipe-cell>
            <div class="address-only">
                <div class="flex-layout">
                    <div class="left">{$vo.nickname}　{$vo.tel}
                        {if $vo.default == 1}<p>默认</p>{/if}
                    </div>
                </div>
                <div>{$vo.p?$vo.p.title:''}{$vo.c?$vo.c.title:''}{$vo.d?$vo.d.title:''}{$vo.details}</div>
            </div>
        </van-swipe-cell>
    </li>
    {/foreach}
</ul>
<p class="save save-fixed">添加收货地址</p>
{include file="public/footer" select="2" /}
<script>
    new Vue({
        el: "#address",
        methods: {},
    });
    $('.choice').click(function (e) {
        var id = $(this).attr('data-id');
        _ajax('{:url("address/choice")}', {id: id});
    })
    $(".save").click(function () {
        if (window.name != '') {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
            parent.window.location.href = "{:url('address/add')}?type=add";
        } else {
            window.location.reload();
        }
    });
</script>
</body>
</html>